import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'request.g.dart';

@JsonSerializable()
class Request {
  String? id;
  RequestField? fields;

  Request();

  factory Request.fromJson(Map<String, dynamic> json) =>
      _$RequestFromJson(json);

  Map<String, dynamic> toJson() => _$RequestToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RequestField {
  String? method;
  String? path;
  String? title;
  String? module;

  RequestField();

  factory RequestField.fromJson(Map<String, dynamic> json) =>
      _$RequestFieldFromJson(json);

  Map<String, dynamic> toJson() => _$RequestFieldToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
